﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEET.CommonInterfaces.Compilers;
using Ins = LEET.StandardModules.Instructions;
using Compiled_Tests.Utils;
using LEET.CommonInterfaces.TestControls;

namespace Tedds_Tool.Instructions.Actions
{
    public class SetVal : Ins.Action
    {
        string value;
        public SetVal(String[] args)
            : base(args)
        {
            value = "";
            for (int i = 3; i < args.Length; ++i)
            {
                value += args[i].Trim();
                if (args.Length > i + 1)
                    value += " | ";
            }
            value = Utilities.Escape(value);
        }

        public static IAutomationActionResult StaticCall()
        {
            //TODO
            return null;
        }

        public override String RenderStaticCall()
        {
            //TODO
            return "Tedds_Tool.Instructions.Actions.SetVal.StaticCall()";
        }

        [Obsolete("This should now be replaced by RenderStaticCall", false)]
        protected override String MethodBody(AssertionSet asserts)
        {
            String pattern = "ValuePattern";
            String action;

            action = "SetValue(\"" + value + "\")";
            
            return MethodBody(pattern, action);
        }

        public override string PlainText()
        {
            string [] split = element.Split(',');
            return "Value of " + split[split.Length - 1] + " set to: " + value + " .";
        }
    }
}
